package com.sz.mes.excel.model;

import java.util.Date;
import java.lang.Double;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.diboot.core.util.D;
import com.diboot.core.util.V;
import com.diboot.file.excel.BaseExcelModel;
import com.diboot.file.excel.annotation.ExcelBindDict;
import com.diboot.file.excel.annotation.ExcelBindField;
import com.diboot.file.excel.annotation.ExcelOption;
import com.fasterxml.jackson.annotation.JsonFormat;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

import com.sz.mes.entity.RequestPurchase;

/**
 * 请购订单 导入model定义
 *
 * @author hem
 * @version 1.0
 * @date 2024-01-10
 * Copyright © szhs
 */
@Getter
@Setter
@ExcelIgnoreUnannotated
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 1)
public class RequestPurchaseImportModel extends BaseExcelModel {

    /**
     * 单据编号
     */
    @Length(max = 100, message = "单据编号长度应小于100")
    @ExcelProperty(value = "单据编号")
    private String receiptNum;
    /**
     * 行号
     */
    @Length(max = 100, message = "行号长度应小于100")
    @ExcelProperty(value = "行号")
    private String receiptNumRow;
    /**
     * 请购单状态
     */
    @Length(max = 100, message = "请购单状态长度应小于100")
    @ExcelProperty(value = "请购单状态")
    private String status;
    /**
     * 业务日期
     */
    @Length(max = 100, message = "业务日期长度应小于100")
    @ExcelProperty(value = "业务日期")
    private String businessDate;
    /**
     * 备注
     */
    @Length(max = 100, message = "备注长度应小于100")
    @ExcelProperty(value = "备注")
    private String remark;
    /**
     * 计划号
     */
    @Length(max = 100, message = "计划号长度应小于100")
    @ExcelProperty(value = "计划号")
    private String planNum;
    /**
     * 料品.料号
     */
    @Length(max = 100, message = "料品.料号长度应小于100")
    @ExcelProperty(value = "料品.料号")
    private String productNum;
    /**
     * 料品名称
     */
    @Length(max = 100, message = "料品名称长度应小于100")
    @ExcelProperty(value = "料品名称")
    private String productName;
    /**
     * 料品规格
     */
    @Length(max = 100, message = "料品规格长度应小于100")
    @ExcelProperty(value = "料品规格")
    private String specification;
    /**
     * 品名2
     */
    @Length(max = 100, message = "品名2长度应小于100")
    @ExcelProperty(value = "品名2")
    private String productNameTwo;
    /**
     * 核准采购数量
     */
    @ExcelProperty(value = "核准采购数量")
    private Integer purchaseQuantity;
    /**
     * 累计转PO数量
     */
    @ExcelProperty(value = "累计转PO数量")
    private Integer transferPoNum;
    /**
     * 累计实到数量
     */
    @ExcelProperty(value = "累计实到数量")
    private Integer actualQuantity;
    /**
     * 采购单位
     */
    @Length(max = 100, message = "采购单位长度应小于100")
    @ExcelProperty(value = "采购单位")
    private String unit;
    /**
     * 要求交货日期
     */
    @Length(max = 100, message = "要求交货日期长度应小于100")
    @ExcelProperty(value = "要求交货日期")
    private String deliveryDate;
    /**
     * 行状态
     */
    @Length(max = 100, message = "行状态长度应小于100")
    @ExcelProperty(value = "行状态")
    private String rowStatus;
    /**
     * 创建人
     */
    @Length(max = 100, message = "创建人长度应小于100")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;
    /**
     * 审核人
     */
    @Length(max = 100, message = "审核人长度应小于100")
    @ExcelProperty(value = "审核人")
    private String auditor;
    /**
     * 请购单行集合.备注
     */
    @Length(max = 100, message = "请购单行集合.备注长度应小于100")
    @ExcelProperty(value = "请购单行集合.备注")
    private String purchaseRemark;
    /**
     * 需求人员.名称
     */
    @Length(max = 100, message = "需求人员.名称长度应小于100")
    @ExcelProperty(value = "需求人员.名称")
    private String requestPersonName;
    /**
     * 审核日期
     */
    @Length(max = 100, message = "审核日期长度应小于100")
    @ExcelProperty(value = "审核日期")
    private String auditDate;
//    /**
//     * excel
//     */
//    @Length(max=100, message="excel长度应小于100")
//    @ExcelProperty(value = "excel")
//    private String excelData;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        RequestPurchaseImportModel requestPurchaseImportModel = (RequestPurchaseImportModel) o;
        Boolean receiptNumSame = true;
        Boolean receiptNumRowSame = true;
        Boolean statusSame = true;
        Boolean businessDateSame = true;
        Boolean remarkSame = true;
        Boolean planNumSame = true;
        Boolean productNumSame = true;
        Boolean productNameSame = true;
        Boolean specificationSame = true;
        Boolean productNameTwoSame = true;
        Boolean purchaseQuantitySame = true;
        Boolean transferPoNumSame = true;
        Boolean actualQuantitySame = true;
        Boolean unitSame = true;
        Boolean deliveryDateSame = true;
        Boolean rowStatusSame = true;
        Boolean createBySame = true;
        Boolean auditorSame = true;
        Boolean purchaseRemarkSame = true;
        Boolean requestPersonNameSame = true;
        Boolean auditDateSame = true;

        if (receiptNum != null) {
            receiptNumSame = receiptNum.equals(requestPurchaseImportModel.receiptNum);
        }
        if (receiptNumRow != null) {
            receiptNumRowSame = receiptNumRow.equals(requestPurchaseImportModel.receiptNumRow);
        }
        if (status != null) {
            statusSame = status.equals(requestPurchaseImportModel.status);
        }
        if (businessDate != null) {
            businessDateSame = businessDate.equals(requestPurchaseImportModel.businessDate);
        }
        if (remark != null) {
            remarkSame = remark.equals(requestPurchaseImportModel.remark);
        }
        if (planNum != null) {
            planNumSame = planNum.equals(requestPurchaseImportModel.planNum);
        }
        if (productNum != null) {
            productNumSame = productNum.equals(requestPurchaseImportModel.productNum);
        }
        if (productName != null) {
            productNameSame = productName.equals(requestPurchaseImportModel.productName);
        }
        if (specification != null) {
            specificationSame = specification.equals(requestPurchaseImportModel.specification);
        }
        if (productNameTwo != null) {
            productNameTwoSame = productNameTwo.equals(requestPurchaseImportModel.productNameTwo);
        }
        if (purchaseQuantity != null) {
            purchaseQuantitySame = purchaseQuantity.equals(requestPurchaseImportModel.purchaseQuantity);
        }
        if (transferPoNum != null) {
            transferPoNumSame = transferPoNum.equals(requestPurchaseImportModel.transferPoNum);
        }
        if (actualQuantity != null) {
            actualQuantitySame = actualQuantity.equals(requestPurchaseImportModel.actualQuantity);
        }
        if (unit != null) {
            unitSame = unit.equals(requestPurchaseImportModel.unit);
        }
        if (deliveryDate != null) {
            deliveryDateSame = deliveryDate.equals(requestPurchaseImportModel.deliveryDate);
        }
        if (rowStatus != null) {
            rowStatusSame = rowStatus.equals(requestPurchaseImportModel.rowStatus);
        }
        if (createBy != null) {
            createBySame = createBy.equals(requestPurchaseImportModel.createBy);
        }
        if (auditor != null) {
            auditorSame = auditor.equals(requestPurchaseImportModel.auditor);
        }
        if (purchaseRemark != null) {
            purchaseRemarkSame = purchaseRemark.equals(requestPurchaseImportModel.purchaseRemark);
        }
        if (requestPersonName != null) {
            requestPersonNameSame = requestPersonName.equals(requestPurchaseImportModel.requestPersonName);
        }
        if (auditDate != null) {
            auditDateSame = auditDate.equals(requestPurchaseImportModel.auditDate);
        }

        return receiptNumSame && receiptNumRowSame && statusSame && businessDateSame && remarkSame && planNumSame &&
                productNumSame && productNameSame && specificationSame && productNameTwoSame && purchaseQuantitySame &&
                transferPoNumSame && actualQuantitySame && unitSame && deliveryDateSame && rowStatusSame &&
                createBySame && auditorSame && purchaseRemarkSame && requestPersonNameSame && auditDateSame;
    }


    @Override
    public int hashCode() {
        return Objects.hash(receiptNum, receiptNumRow, status, businessDate, remark, planNum, productNum, productName,
                specification, productNameTwo, purchaseQuantity, transferPoNum, actualQuantity, unit, deliveryDate,
                rowStatus, createBy, auditor, purchaseRemark, requestPersonName, auditDate);
    }
}
